package com.huawei.hianalytics.ab.cd.bc;

import android.content.Context;
import android.text.TextUtils;
import android.util.Pair;
import com.huawei.hianalytics.ab.bc.ab.bc;
import java.util.UUID;

public class ab {
    private static ab bc;
    private Context ab;

    static class ab extends bc {
        String ab;
        String bc;

        public ab(String str, String str2) {
            this.ab = str;
            this.bc = str2;
        }

        public String ab() {
            return com.huawei.hianalytics.ab.ab.ab.bc(this.ab, this.bc);
        }

        public String ab(String str) {
            return bc.ab().ab(str);
        }

        public String bc() {
            return com.huawei.hianalytics.ab.ab.ab.ab(this.ab, this.bc);
        }

        public String cd() {
            return com.huawei.hianalytics.ab.ab.ab.de(this.ab, this.bc);
        }

        public int de() {
            int i = 0;
            int i2 = (com.huawei.hianalytics.ab.ab.ab.gh(this.ab, this.bc) ? 2 : 0) | (0 | (com.huawei.hianalytics.ab.ab.ab.hi(this.ab, this.bc) ? 4 : 0));
            if (com.huawei.hianalytics.ab.ab.ab.ik(this.ab, this.bc)) {
                i = 1;
            }
            return i2 | i;
        }
    }

    public static ab ab() {
        ab abVar;
        synchronized (ab.class) {
            if (bc == null) {
                bc = new ab();
            }
            abVar = bc;
        }
        return abVar;
    }

    public com.huawei.hianalytics.ab.cd.ab.ab ab(String str, String str2) {
        return new ab(str, str2).ab(this.ab);
    }

    public String ab(boolean z) {
        if (!z) {
            return "";
        }
        Object gh = com.huawei.hianalytics.ab.ab.bc.gh();
        if (!TextUtils.isEmpty(gh)) {
            return gh;
        }
        String bc = com.huawei.hianalytics.ab.bc.ij.ab.bc(this.ab, "global_v2", "uuid", "");
        if (TextUtils.isEmpty(bc)) {
            bc = UUID.randomUUID().toString().replace("-", "");
            com.huawei.hianalytics.ab.bc.ij.ab.ab(this.ab, "global_v2", "uuid", bc);
        }
        com.huawei.hianalytics.ab.ab.bc.ab(bc);
        return bc;
    }

    public void ab(Context context) {
        if (this.ab == null) {
            this.ab = context;
        }
    }

    public Pair<String, String> bc(String str, String str2) {
        if (!com.huawei.hianalytics.ab.ab.ab.fg(str, str2)) {
            return new Pair("", "");
        }
        CharSequence b = com.huawei.hianalytics.ab.bc.cd.ab.ab.ab().cd().b();
        CharSequence c = com.huawei.hianalytics.ab.bc.cd.ab.ab.ab().cd().c();
        if (!TextUtils.isEmpty(b) && !TextUtils.isEmpty(c)) {
            return new Pair(b, c);
        }
        Pair<String, String> gh = cd.gh(this.ab);
        com.huawei.hianalytics.ab.bc.cd.ab.ab.ab().cd().lm((String) gh.first);
        com.huawei.hianalytics.ab.bc.cd.ab.ab.ab().cd().a((String) gh.second);
        return gh;
    }

    public String cd(String str, String str2) {
        return de.bc(str, str2);
    }

    public String de(String str, String str2) {
        return com.huawei.hianalytics.ab.bc.bc.bc.ab(this.ab, str, str2);
    }

    public String ef(String str, String str2) {
        return com.huawei.hianalytics.ab.bc.bc.bc.bc(this.ab, str, str2);
    }

    public String fg(String str, String str2) {
        return de.ab(str, str2);
    }
}
